package com.hzit.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hzit.entity.Emp;
import com.hzit.service.EmpService;
import com.hzit.mapper.EmpMapper;
import com.hzit.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import javax.xml.transform.Templates;

/**
 *
 */
@Service
public class EmpServiceImpl extends ServiceImpl<EmpMapper, Emp>
    implements EmpService{

    @Autowired
    private RestTemplate restTemplate;

    @Override
    public R findStudentById(Integer id) {
        String url="http://hzit-student/api/student/findById/"+id;
        ResponseEntity<R> exchange = restTemplate.exchange(url, HttpMethod.GET, null, R.class);
        // ResponseEntity<R> r = restTemplate.getForEntity("http://hzit-student/student/findById/" + id, R.class);
        R body = exchange.getBody();
        return body;
    }
}




